<p>Conditional expressions which are always <code>true</code> or <code>false</code> can lead to dead code. Such code is always buggy and should never
be used in production.</p>
<h2>Noncompliant Code Example</h2>
<pre>
a = false;
if (a) { // Noncompliant
  doSomething(); // never executed
}

if (!a || b) { // Noncompliant; "!a" is always "true", "b" is never evaluated
  doSomething();
} else {
  doSomethingElse(); // never executed
}
</pre>
<h2>Exceptions</h2>
<p>This rule will not raise an issue in either of these cases:</p>
<ul>
  <li> When the condition is a single <code>final boolean</code> </li>
</ul>
<pre>
final boolean debug = false;
//...
if (debug) {
  // Print something
}
</pre>
<ul>
  <li> When the condition is literally <code>true</code> or <code>false</code>. </li>
</ul>
<pre>
if (true) {
  // do something
}
</pre>
<p>In these cases it is obvious the code is as intended.</p>
<h2>See</h2>
<ul>
  <li> <a href="https://cwe.mitre.org/data/definitions/570.html">MITRE, CWE-570</a> - Expression is Always False </li>
  <li> <a href="https://cwe.mitre.org/data/definitions/571.html">MITRE, CWE-571</a> - Expression is Always True </li>
  <li> <a href="https://wiki.sei.cmu.edu/confluence/x/5dUxBQ">CERT, MSC12-C.</a> - Detect and remove code that has no effect or is never executed
  </li>
</ul>

